<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<Script runat="server">
  Public Sub Page_Load(sender As Object, e As EventArgs)
    Dim connection As SqlConnection
    Dim command As SqlCommand
    Dim reader As SqlDataReader
    Dim sqlSelect As String
    Try
	    Dim strConn= _
		ConfigurationSettings.appSettings("conn")
	    sqlSelect="Select * From tblSubCategory"
	    sqlSelect +=" where SubCateID>10"    
	    connection = _
		New SqlConnection(strConn )
	    command = _
		New SqlCommand(sqlSelect, connection)
	    connection.Open()
	    reader = command.ExecuteReader()
	    datagrid1.DataSource = reader
	    datagrid1.DataBind()
	    connection.Close()  
    Catch objError As Exception
      	outError.innerHTML = _
	"<b>* Error while " & _
	"accessing data</b>.<br />" _
          	& objError.Message & "<br />" & _
	objError.Source
      	Exit Sub  
   End Try     
  End Sub

</Script>
<div id="outError" runat="server">&nbsp;</div>
<asp:datagrid id="datagrid1" runat="server" />
